package com.py.comment.controller;

import com.py.comment.service.CommentReplyService;
import com.py.model.common.dtos.ResponseResult;
import com.py.model.moment.dtos.CommentReplyDto;
import com.py.model.moment.dtos.CommentReplyLikeDto;
import com.py.model.moment.dtos.CommentReplySaveDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author pengy
 * @create 2022-11-17 17:04
 */
@RestController
@RequestMapping("/api/v1/comment_repay")
public class CommentReplyController {
    @Autowired
    private CommentReplyService replyService;


    /**
     * 回复评论的保存mongoDB
     * @param replySaveDto
     * @return
     */
    @PostMapping("/save")
    public ResponseResult replySave(@RequestBody CommentReplySaveDto replySaveDto){
         replyService.saveReply(replySaveDto);
         return ResponseResult.okResult(null);
    }

    /**
     * 加载回复评论列表 分页展示
     * @return
     */
    @PostMapping("/load")
    public ResponseResult load(@RequestBody CommentReplyDto commentReplyDto){
            return replyService.loadPage(commentReplyDto);
    }


    /**
     * 回复评论的评论点赞或取消点赞
     * @param replyLikeDto
     * @return
     */
    @PostMapping("/like")
    public ResponseResult like(@RequestBody CommentReplyLikeDto replyLikeDto){
        return replyService.like(replyLikeDto);
    }


}
